namespace Game.Common.Resources
{
    public class ReadonlyGameResources
    {
        readonly ReadonlyGameResource _Energy;
        readonly ReadonlyGameResource _Material;
        readonly ReadonlyGameResource _Fuel;
        
        public ReadonlyGameResources(GameResources copy)
        {
            _Energy = new ReadonlyGameResource(copy.Energy);
            _Fuel = new ReadonlyGameResource(copy.Fuel);
            _Material = new ReadonlyGameResource(copy.Material);
        }

        public ReadonlyGameResources(
            double energy,
            double fuel,
            double material)
        {
            _Energy = new ReadonlyGameResource(
                new GameResource(GameResourceType.Energy, energy));
            _Fuel = new ReadonlyGameResource(
                new GameResource(GameResourceType.Fuel, fuel));
            _Material = new ReadonlyGameResource(
                new GameResource(GameResourceType.Material, material));
        }

        public ReadonlyGameResource Energy
        {
            get { return _Energy; }
        }
        
        public ReadonlyGameResource Fuel
        {
            get { return _Fuel; }
        }
        
        public ReadonlyGameResource Material
        {
            get { return _Material; }
        }

        public override string ToString()
        {
            return
                "(Energy:" + _Energy.Value +
                " Material:" + _Material.Value +
                " Fuel:" + _Fuel.Value + ")";
        }
        
    }
}